Running an analysis¶
The solver module is used to interact with OpenSees.
The most convenient approach is using a child of the Analysis class from those already defined in the solver module for the specific analysis that is needed. This will run the analysis and store the requested results of each analysis step.
Alternatively, a generic Analysis object can be defined (from the parent class), and its generic methods for model definition can be used together with OpenSees commands issued directly in the analysis script. If such an analysis is repeated a lot, a new Analysis child class can be defined in the solver module.
Analysis examples¶
First we define a model.
[1]:
# This cell defines the model from notebook 2_Define_a_Model
import numpy as np
from osmg import model
import osmg.defaults as defaults
from osmg.gen.section_gen import SectionGenerator
from osmg.ops.section import ElasticSection
from osmg.gen.component_gen import BeamColumnGenerator
from osmg.ops.element import ElasticBeamColumn
from osmg.gen.zerolength_gen import gravity_shear_tab
from osmg.load_case import LoadCase
from osmg.preprocessing.self_weight_mass import self_weight
from osmg.preprocessing.self_weight_mass import self_mass
from osmg.graphics.preprocessing_3d import show
mdl = model.Model('example_model')
for i in range(3):
mdl.add_level(i, 144.00*(i))
defaults.load_default_steel(mdl)
defaults.load_default_fix_release(mdl)
defaults.load_util_rigid_elastic(mdl)
steel_phys_mat = mdl.physical_materials.retrieve_by_attr(
'name', 'default steel')
secg = SectionGenerator(mdl)
secg.load_aisc_from_database(
'W',
["W24X94"],
'default steel',
'default steel',
ElasticSection)
mdl.levels.set_active([1, 2])
p1 = np.array((0.00, 0.00))
p2 = np.array((360., 0.00))
p3 = np.array((360., 360.))
p4 = np.array((0.00, 360.00))
mcg = BeamColumnGenerator(mdl)
sec = mdl.elastic_sections.retrieve_by_attr('name', 'W24X94')
for pt in [p1, p2, p3, p4]:
mcg.add_pz_active(
pt[0], pt[1],
sec,
steel_phys_mat,
0.00,
24.00,
24.00,
"steel_w_col_pz_updated",
{'pz_doubler_plate_thickness': 0.00,
'axial_load_ratio': 0.00,
'slab_depth': 0.00,
'consider_composite': False,
'location': 'interior',
'only_elastic': False,
'moment_modifier': 1.00,
})
mcg.add_vertical_active(
x_coord=pt[0], y_coord=pt[1],
offset_i=np.zeros(3), offset_j=np.zeros(3),
transf_type='Corotational',
n_sub=1,
section=sec,
element_type=ElasticBeamColumn,
placement='centroid',
angle=0.00)
snap_i_list = ['centroid', 'middle_front', 'centroid', 'middle_back']
snap_j_list = ['centroid', 'middle_back', 'centroid', 'middle_front']
for i, pair in enumerate([(p1, p2), (p2, p3), (p3, p4), (p4, p1)]):
mcg.add_horizontal_active(
xi_coord=pair[0][0],
yi_coord=pair[0][1],
xj_coord=pair[1][0],
yj_coord=pair[1][1],
offset_i=np.zeros(3),
offset_j=np.zeros(3),
snap_i=snap_i_list[i],
snap_j=snap_j_list[i],
transf_type='Linear',
n_sub=4,
section=sec,
element_type=ElasticBeamColumn,
placement='top_center',
angle=0.00,
method='generate_hinged_component_assembly',
additional_args={
'n_x': None,
'n_y': None,
'zerolength_gen_i': gravity_shear_tab,
'zerolength_gen_args_i': {
'consider_composite': True,
'section': sec,
'physical_material': steel_phys_mat,
'distance': 10.00,
'n_sub': 2
},
'zerolength_gen_j': gravity_shear_tab,
'zerolength_gen_args_j': {
'consider_composite': True,
'section': sec,
'physical_material': steel_phys_mat,
'distance': 10.00,
'n_sub': 2
}
}
)
for node in mdl.levels[0].nodes.values():
node.restraint = [True]*6
testcase = LoadCase('test', mdl)
self_weight(mdl, testcase)
self_mass(mdl, testcase)
testcase.rigid_diaphragms([1, 2])
[2]:
show(mdl, testcase, extrude=True)
Static Analysis¶
[3]:
from osmg import solver
[4]:
# instantiate analysis object
static_anl = solver.StaticAnalysis(mdl, {testcase.name: testcase})
[5]:
static_anl.run()
Retrieving results¶
Analysis results are stored in dictionaries. The keys are the unique identifiers of the elements that the results correspond to, and the values contain the results.
Show all node displacement results
[6]:
# DANGER: Don't do this for a large model.
static_anl.results[testcase.name].node_displacements.items()
[6]:
dict_items([(24, {0: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]}), (49, {0: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]}), (74, {0: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]}), (99, {0: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]}), (0, {0: [-2.383099e-14, 1.7265125598783e-07, -0.0012586174501052919, -2.49865238929242e-06, 4.274053967792305e-05, -2.42e-18]}), (5, {0: [-0.0002696903680179773, -0.0001169887324373217, -0.0012837579008101454, -1.008034823091287e-05, 2.23198364987914e-05, 1.7106571392e-10]}), (6, {0: [-0.00026968626244084314, -0.00011864489630441313, -0.0012210781144691243, -9.90146229670008e-06, 2.231949850356967e-05, 1.7106571392e-10]}), (11, {0: [-0.0005354828823736746, -0.0002374624438648141, -0.0012434781525435116, -2.49629541992047e-06, 7.12680806479406e-06, 3.4213143027e-10]}), (25, {0: [-2.383099e-14, 1.7265125511697e-07, -0.0012586174501053068, -2.49865238928301e-06, -4.274053967788061e-05, -2.42e-18]}), (30, {0: [0.0002696903679687893, -0.00011698873243808192, -0.0012837579008100478, -1.008034823090366e-05, -2.231983649865864e-05, -1.7106571884e-10]}), (31, {0: [0.0002696862623915372, -0.00011864489630517336, -0.001221078114469252, -9.90146229669086e-06, -2.231949850343677e-05, -1.7106571884e-10]}), (36, {0: [0.0005354828823228242, -0.00023746244386546372, -0.0012434781525435265, -2.4962954199111e-06, -7.12680806458369e-06, -3.4213143525e-10]}), (50, {0: [-2.296014e-14, 1.7265125511697e-07, -0.0012604649482101603, 2.30877209432053e-06, -4.274053963882948e-05, -2.42e-18]}), (55, {0: [0.00026968627322281925, 0.0001234949976323278, -0.0012232472716589503, 1.026785631196658e-05, -2.23194993906966e-05, 1.6975587572e-10]}), (56, {0: [0.00026969034736383664, 0.00012378908697243375, -0.0012813834716694033, 1.062652896589847e-05, -2.231983479798712e-05, 1.6975587572e-10]}), (61, {0: [0.0005354828725384923, 0.00024876312029784004, -0.0012433763107766495, 2.30797285406344e-06, -7.12680793598549e-06, 3.3951175387e-10]}), (75, {0: [-2.296014e-14, 1.7265125598783e-07, -0.0012604649482101738, 2.3087720943112e-06, 4.274053963876581e-05, -2.42e-18]}), (80, {0: [-0.0002696862732671918, 0.00012349499763308926, -0.0012232472716590752, 1.026785631195746e-05, 2.231949939057199e-05, -1.697558807e-10]}), (81, {0: [-0.00026969034740832867, 0.00012378908697319524, -0.001281383471669305, 1.062652896588936e-05, 2.231983479786279e-05, -1.697558807e-10]}), (86, {0: [-0.0005354828725814248, 0.00024876312029849213, -0.0012433763107766627, 2.30797285405417e-06, 7.12680793581305e-06, -3.3951175898e-10]}), (12, {0: [-3.815788e-14, 1.190554506578007e-05, -0.0018451516126739922, -7.57678726589928e-06, 4.690221456332177e-05, -6.73e-18]}), (17, {0: [-0.00016195447261509348, -0.00013283729784503682, -0.0019339910154655797, -1.239120855627931e-05, 1.327098300692452e-05, 2.07013088324e-09]}), (18, {0: [-0.00016190478947389559, -0.0001342643419718129, -0.0017534988096083019, -1.218082391979941e-05, 1.326689279857626e-05, 2.07013088324e-09]}), (23, {0: [-0.00031796976638304294, -0.0002804342290094058, -0.0018399676172023117, -7.26668028907571e-06, -6.96539955716247e-06, 4.14026177322e-09]}), (37, {0: [-3.815788e-14, 1.190554506335684e-05, -0.0018451516126740146, -7.57678726588825e-06, -4.690221456328503e-05, -6.73e-18]}), (42, {0: [0.00016195447253766944, -0.00013283729784733218, -0.0019339910154654698, -1.239120855626867e-05, -1.327098300681813e-05, -2.07013089661e-09]}), (43, {0: [0.00016190478939615092, -0.0001342643419741083, -0.001753498809608457, -1.218082391978876e-05, -1.326689279847007e-05, -2.07013089661e-09]}), (48, {0: [0.00031796976630417585, -0.0002804342290115734, -0.0018399676172023342, -7.26668028906467e-06, 6.96539955732844e-06, -4.14026178648e-09]}), (62, {0: [-3.573465e-14, 1.190554506335684e-05, -0.0018481986195594189, 7.35839727478974e-06, -4.690221456073339e-05, -6.73e-18]}), (67, {0: [0.00016190480659050347, 0.00015797762027587893, -0.0017579507574157559, 1.216705369283929e-05, -1.32668942135986e-05, 2.06867471384e-09]}), (68, {0: [0.00016195445478363565, 0.0001577654373542371, -0.0019332033590187107, 1.248978357781605e-05, -1.327098154488086e-05, 2.06867471384e-09]}), (73, {0: [0.00031796976574247727, 0.00030526376668349865, -0.0018417998820094749, 7.04851235373395e-06, 6.96539955616768e-06, 4.13734943441e-09]}), (87, {0: [-3.573465e-14, 1.190554506578007e-05, -0.0018481986195594343, 7.35839727477872e-06, 4.690221456073326e-05, -6.73e-18]}), (92, {0: [-0.00016190480666180047, 0.00015797762027817467, -0.0017579507574159035, 1.216705369282866e-05, 1.326689421359776e-05, -2.06867472735e-09]}), (93, {0: [-0.00016195445485525696, 0.0001577654373565329, -0.0019332033590185938, 1.248978357780545e-05, 1.327098154488012e-05, -2.06867472735e-09]}), (98, {0: [-0.00031796976581392717, 0.000305263766685667, -0.0018417998820094903, 7.04851235372291e-06, -6.96539955616e-06, -4.13734944798e-09]}), (1, {0: [1.8962410508954e-07, 1.35777464421317e-06, -0.0012884092086081157, -2.556090706794e-06, 2.266835029975457e-05, -2.35927500019e-08]}), (2, {0: [1.8968603414265e-07, 1.7265125598783e-07, -0.0012262476392814496, -2.79690015833407e-06, 2.266801541233302e-05, 2.360203556887e-08]}), (3, {0: [1.9067925630437e-07, 1.43710877902662e-06, -0.0012881173779430441, -9.68160894799988e-06, 2.266834931840465e-05, -2.359274884007e-08]}), (4, {0: [1.907413218003e-07, 1.7265125598783e-07, -0.0012259232948326167, -9.90146229670008e-06, 2.266801443096673e-05, 2.36020344233e-08]}), (7, {0: [-0.0005356766120797293, -0.0002377769697798311, -0.0012766940168110763, -2.90383532348536e-06, 2.201939058007186e-05, 2.393488142975e-08]}), (8, {0: [-0.000535668462854514, -0.0002374624438648141, -0.0012159085896567992, -2.19804765087882e-06, 2.201905569265031e-05, -2.325990414102e-08]}), (9, {0: [-0.0005356776672309441, -0.0002377980246687922, -0.0012771372164562032, -1.006098741347738e-05, 2.201939130818549e-05, 2.393488026791e-08]}), (10, {0: [-0.0005356695181421716, -0.0002374624438648141, -0.001216232934105632, -9.90146229670008e-06, 2.201905642074757e-05, -2.325990299546e-08]}), (26, {0: [-1.8962415269396e-07, 1.35777464334239e-06, -0.001288409208608018, -2.5560907067846e-06, -2.266835029962341e-05, 2.359274999713e-08]}), (27, {0: [-1.8968608186317e-07, 1.7265125511697e-07, -0.0012262476392815775, -2.79690015832467e-06, -2.266801541220171e-05, -2.360203557376e-08]}), (28, {0: [-1.9067930390879e-07, 1.43710877815585e-06, -0.0012881173779429463, -9.68160894799066e-06, -2.266834931827348e-05, 2.359274883529e-08]}), (29, {0: [-1.9074136952082e-07, 1.7265125511697e-07, -0.0012259232948327447, -9.90146229669086e-06, -2.266801443083541e-05, -2.36020344282e-08]}), (32, {0: [0.0005356766120289392, -0.0002377769697804808, -0.0012766940168109787, -2.90383532347598e-06, -2.201939057993763e-05, -2.39348814348e-08]}), (33, {0: [0.0005356684628036044, -0.00023746244386546372, -0.0012159085896569265, -2.19804765086944e-06, -2.201905569251594e-05, 2.325990413609e-08]}), (34, {0: [0.000535677667180154, -0.00023779802466944192, -0.0012771372164561057, -1.006098741346817e-05, -2.201939130805127e-05, -2.393488027296e-08]}), (35, {0: [0.000535669518091262, -0.00023746244386546372, -0.0012162329341057594, -9.90146229669086e-06, -2.20190564206132e-05, 2.325990299053e-08]}), (51, {0: [-1.8968586727051e-07, 1.48973809286611e-06, -0.0012284244104318754, 2.93175518713791e-06, -2.26680162913484e-05, 2.360200293462e-08]}), (52, {0: [-1.8962441284602e-07, -2.32955897085751e-06, -0.0012860270024920833, 2.0408707380801e-06, -2.266834861457862e-05, -2.35927885216e-08]}), (53, {0: [-1.9074115453615e-07, 1.57790608092977e-06, -0.0012280995882706911, 1.002463427592891e-05, -2.266801530998215e-05, 2.3602001789e-08]}), (54, {0: [-1.9067956471604e-07, -2.49706109373462e-06, -0.0012857356597671718, 1.047250402532181e-05, -2.266834763322862e-05, -2.359278735982e-08]}), (57, {0: [0.0005356684842417852, 0.0002474460334600909, -0.0012180701328860252, 2.00928580929629e-06, -2.201905657003089e-05, -2.326249118318e-08]}), (58, {0: [0.0005356765710693956, 0.0002503947330506062, -0.0012743282884358465, 2.71501078036791e-06, -2.201938889326111e-05, 2.393230027304e-08]}), (59, {0: [0.0005356695395290509, 0.00024735786547202724, -0.0012183949550472095, 1.034893032397914e-05, -2.20190572981282e-05, -2.326249003755e-08]}), (60, {0: [0.0005356776262212655, 0.00025050395592763095, -0.0012747709421807025, 1.052609413645042e-05, -2.201938962137466e-05, 2.393229911127e-08]}), (76, {0: [1.8968582140877e-07, 1.489738093737e-06, -0.0012284244104320005, 2.93175518712861e-06, 2.266801629122484e-05, -2.360200293952e-08]}), (77, {0: [1.8962436686816e-07, -2.32955896998677e-06, -0.001286027002491985, 2.04087073807079e-06, 2.266834861445534e-05, 2.359278851682e-08]}), (78, {0: [1.9074110867442e-07, 1.57790608180066e-06, -0.0012280995882708162, 1.002463427591978e-05, 2.266801530985859e-05, -2.36020017939e-08]}), (79, {0: [1.9067951873818e-07, -2.49706109286389e-06, -0.0012857356597670735, 1.047250402531271e-05, 2.266834763310534e-05, 2.359278735504e-08]}), (82, {0: [-0.0005356684842846569, 0.000247446033460743, -0.00121807013288615, 2.009285809287e-06, 2.201905656990535e-05, 2.326249117812e-08]}), (83, {0: [-0.0005356765711123899, 0.0002503947330512584, -0.0012743282884357483, 2.71501078035863e-06, 2.201938889313584e-05, -2.393230027822e-08]}), (84, {0: [-0.0005356695395719224, 0.0002473578654726793, -0.0012183949550473342, 1.034893032397002e-05, 2.201905729800265e-05, 2.326249003249e-08]}), (85, {0: [-0.0005356776262642599, 0.00025050395592828316, -0.0012747709421806045, 1.052609413644131e-05, 2.20193896212494e-05, -2.393229911645e-08]}), (100, {0: [-0.0004904605621380467, -3.018597527393932e-05, -0.0017047541553917604, -2.49865238929223e-06, 4.615124192144528e-05, -2.42e-18]}), (101, {0: [-0.0004902289145574323, -3.018597527393932e-05, -0.0017049072970584272, -2.49865238929223e-06, 0.00014738045011043467, -2.08e-18]}), (102, {0: [-0.0005048790596243215, -3.018597527392722e-05, -0.001477425421010712, -2.49865238929232e-06, 4.469756039312819e-05, -2.42e-18]}), (103, {0: [0.0004904605620898691, -3.018597527464741e-05, -0.0017047541553913558, -2.49865238928322e-06, -4.615124192140379e-05, -2.42e-18]}), (104, {0: [0.0004902289145092546, -3.018597527464741e-05, -0.0017049072970580226, -2.49865238928322e-06, -0.00014738045011043188, -2.08e-18]}), (105, {0: [0.0005048790595761438, -3.018597527465951e-05, -0.001477425421010516, -2.49865238928312e-06, -4.469756039308622e-05, -2.42e-18]}), (106, {0: [-0.00024511445729076054, -3.018597527411634e-05, -0.013352521289531162, -2.49865238928998e-06, 0.00010901744541494267, -2.08e-18]}), (107, {0: [-2.408887e-14, -3.018597527429336e-05, -0.018235997197214176, -2.49865238928772e-06, -2.49e-18, -2.08e-18]}), (108, {0: [0.0002451144572425828, -3.018597527447039e-05, -0.013352521289530794, -2.49865238928547e-06, -0.00010901744541494571, -2.08e-18]}), (118, {0: [0.00027304005410077654, -0.0001112458057293148, -0.0014027103158259326, -1.339752341980696e-05, -2.231983644804443e-05, -1.7106571884e-10]}), (119, {0: [0.00027304005410077654, -0.00011118752648346245, -0.0014028526764726546, -0.000113589097142065, -2.231983644804443e-05, 1.0746356e-13]}), (120, {0: [0.0002730391987721824, -0.00011487329520101616, -0.0013390906353984496, -1.197339433970507e-05, -2.231983647335154e-05, -1.7106571884e-10]}), (121, {0: [0.0002730400201422921, 0.00011812808737391587, -0.0014057367483249555, 1.393163838462881e-05, -2.231983484860257e-05, 1.6975587572e-10]}), (122, {0: [0.0002730400201422921, 0.00011806980812806352, -0.0014058790510115668, 0.000113631539986655, -2.231983484860257e-05, 1.0746356e-13]}), (123, {0: [0.0002730391713629135, 0.00012175557684561723, -0.001339431719290355, 1.251344966070103e-05, -2.231983482329484e-05, 1.6975587572e-10]}), (124, {0: [0.0002730400456111554, -5.387319283058095e-05, -0.009814545560634045, -8.51803975923069e-05, -2.231983604818397e-05, 1.0746356e-13]}), (125, {0: [0.0002730400371215343, 3.44114082230054e-06, -0.013367025159814276, -2.497641307271e-08, -2.23198356483235e-05, 1.0746356e-13]}), (126, {0: [0.0002730400286319132, 6.075547447518203e-05, -0.009817883562400525, 8.515354368384534e-05, -2.231983524846303e-05, 1.0746356e-13]}), (136, {0: [0.0004904605616426522, 2.822423220113558e-05, -0.0017066016531089485, 2.30877209432027e-06, -4.615124188300278e-05, -2.42e-18]}), (137, {0: [0.0004902289140622496, 2.822423220113558e-05, -0.0017067547947756153, 2.30877209432027e-06, -0.00014738045009936304, -2.09e-18]}), (138, {0: [0.0005048790591157353, 2.822423220112348e-05, -0.0014792729189209266, 2.3087720943204e-06, -4.469756035436014e-05, -2.42e-18]}), (139, {0: [-0.000490460561687799, 2.822423220184475e-05, -0.0017066016531083327, 2.30877209431155e-06, 4.615124188294055e-05, -2.42e-18]}), (140, {0: [-0.0004902289141073964, 2.822423220184475e-05, -0.0017067547947749993, 2.30877209431155e-06, 0.00014738045009935876, -2.09e-18]}), (141, {0: [-0.000504879059160882, 2.822423220185685e-05, -0.0014792729189206236, 2.30877209431137e-06, 4.46975603542972e-05, -2.42e-18]}), (142, {0: [0.00024511445701983815, 2.822423220131287e-05, -0.013354368786542475, 2.30877209431809e-06, -0.00010901744540940569, -2.09e-18]}), (143, {0: [-2.257339e-14, 2.822423220149017e-05, -0.018237844693990105, 2.30877209431591e-06, 3.78e-18, -2.09e-18]}), (144, {0: [-0.0002451144570649849, 2.822423220166746e-05, -0.013354368786541917, 2.30877209431373e-06, 0.0001090174454094103, -2.09e-18]}), (154, {0: [-0.0002730400201868153, 0.00011812808737467593, -0.0014057367483247675, 1.393163838461994e-05, 2.231983484848653e-05, -1.697558807e-10]}), (155, {0: [-0.0002730400201868153, 0.00011806980812882358, -0.0014058790510113788, 0.00011363153998665502, 2.231983484848653e-05, -1.0747823e-13]}), (156, {0: [-0.00027303917140741174, 0.00012175557684637731, -0.0013394317192902117, 1.251344966069204e-05, 2.231983482317466e-05, -1.697558807e-10]}), (157, {0: [-0.0002730400541499354, -0.00011124580572855592, -0.0014027103158261213, -1.339752341981594e-05, 2.231983644816941e-05, 1.7106571392e-10]}), (158, {0: [-0.0002730400541499354, -0.00011118752648270358, -0.0014028526764728432, -0.00011358909714206493, 2.231983644816941e-05, -1.0747823e-13]}), (159, {0: [-0.00027303919882136577, -0.0001148732952002573, -0.0013390906353985931, -1.197339433971416e-05, 2.23198364734804e-05, 1.7106571392e-10]}), (160, {0: [-0.0002730400286775953, 6.07554744759418e-05, -0.009817883562400397, 8.515354368384666e-05, 2.231983524840725e-05, -1.0747823e-13]}), (161, {0: [-0.0002730400371683753, 3.44114082306001e-06, -0.013367025159814274, -2.497641307094e-08, 2.231983564832796e-05, -1.0747823e-13]}), (162, {0: [-0.00027304004565915533, -5.387319282982178e-05, -0.009814545560634172, -8.518039759230555e-05, 2.231983604824869e-05, -1.0747823e-13]}), (13, {0: [4.8569465919027e-07, 1.36600871447874e-05, -0.001936247319295587, -7.64922182871518e-06, 1.382335767151189e-05, -6.042186900774e-08]}), (14, {0: [4.8644408411704e-07, 1.190554506578007e-05, -0.0017539992078422807, -7.60565697101429e-06, 1.381930507214604e-05, 6.053423689809e-08]}), (15, {0: [4.8839826870824e-07, 1.377753911579295e-05, -0.0019361057550998995, -1.208059820799861e-05, 1.382335605425265e-05, -6.042186595244e-08]}), (16, {0: [4.8914934476725e-07, 1.190554506578007e-05, -0.001753967812037968, -1.218082391979941e-05, 1.381930345468867e-05, 6.053423403972e-08]}), (19, {0: [-0.00031850514422158895, -0.0002811380774682078, -0.0019293225158222395, -7.53602218295312e-06, 1.284177247456165e-05, 6.456213077423e-08]}), (20, {0: [-0.00031840652736411996, -0.0002804342290094058, -0.0017529984113743232, -7.23781058396071e-06, 1.283771987519581e-05, -5.63939751316e-08]}), (21, {0: [-0.0003185078478311069, -0.0002811851942571208, -0.0019296154251318312, -1.234788277337084e-05, 1.284177344295461e-05, 6.456212771893e-08]}), (22, {0: [-0.00031840923262477016, -0.0002804342290094058, -0.0017530298071786357, -1.218082391979941e-05, 1.283772084339063e-05, -5.639397227323e-08]}), (38, {0: [-4.8569473534484e-07, 1.366008714236423e-05, -0.001936247319295477, -7.64922182870415e-06, -1.382335767140672e-05, 6.042186899432e-08]}), (39, {0: [-4.8644416059468e-07, 1.190554506335684e-05, -0.0017539992078424355, -7.60565697100325e-06, -1.381930507204108e-05, -6.053423691159e-08]}), (40, {0: [-4.8839834486282e-07, 1.377753911336978e-05, -0.0019361057550997898, -1.208059820798795e-05, -1.382335605414748e-05, 6.042186593903e-08]}), (41, {0: [-4.8914942124489e-07, 1.190554506335684e-05, -0.001753967812038123, -1.218082391978876e-05, -1.38193034545837e-05, -6.053423405322e-08]}), (44, {0: [0.00031850514414288135, -0.00028113807747037544, -0.0019293225158221294, -7.53602218294208e-06, -1.284177247445413e-05, -6.456213078753e-08]}), (45, {0: [0.00031840652728509414, -0.0002804342290115734, -0.0017529984113744783, -7.23781058394966e-06, -1.283771987508849e-05, 5.639397511838e-08]}), (46, {0: [0.0003185078477523993, -0.00028118519425928844, -0.0019296154251317213, -1.234788277336019e-05, -1.284177344284709e-05, -6.456212773224e-08]}), (47, {0: [0.00031840923254574435, -0.0002804342290115734, -0.0017530298071787907, -1.218082391978876e-05, -1.28377208432833e-05, 5.639397226001e-08]}), (63, {0: [-4.8644389607999e-07, 1.272734415751139e-05, -0.0017584522967525665, 7.58967801325741e-06, -1.381930647411744e-05, 6.053419758257e-08]}), (64, {0: [-4.8569499869413e-07, 9.32920389019498e-06, -0.0019354585217458862, 7.22828913591355e-06, -1.382335622282357e-05, -6.042190878135e-08]}), (65, {0: [-4.8914915615866e-07, 1.278235675853925e-05, -0.0017584208293535944, 1.201529479345208e-05, -1.381930485666013e-05, 6.053419472413e-08]}), (66, {0: [-4.8839860880413e-07, 9.15673931816157e-06, -0.0019353170291448584, 1.233119546560142e-05, -1.382335460556426e-05, -6.042190572612e-08]}), (69, {0: [0.0003184065614096904, 0.00030444196758934406, -0.0017574492180789452, 7.01957681444923e-06, -1.28377212772325e-05, -5.639684815489e-08]}), (70, {0: [0.000318505108898569, 0.00030678941423645516, -0.0019285361634928926, 7.31777900856026e-06, -1.284177102593864e-05, 6.455925820904e-08]}), (71, {0: [0.0003184092666697691, 0.0003043869549883162, -0.0017574806854779173, 1.221763999263502e-05, -1.283772224542739e-05, -5.639684529645e-08]}), (72, {0: [0.000318507812508679, 0.00030689154362639596, -0.0019288289909800162, 1.239587149511184e-05, -1.284177199433152e-05, 6.455925515381e-08]}), (88, {0: [4.8644382477261e-07, 1.272734415993468e-05, -0.0017584522967527142, 7.5896780132464e-06, 1.381930647411657e-05, -6.053419759608e-08]}), (89, {0: [4.8569492706364e-07, 9.32920389261807e-06, -0.0019354585217457693, 7.22828913590252e-06, 1.38233562228228e-05, 6.042190876793e-08]}), (90, {0: [4.8914908485128e-07, 1.278235676096255e-05, -0.001758420829353742, 1.201529479344144e-05, 1.381930485665926e-05, -6.053419473764e-08]}), (91, {0: [4.8839853717364e-07, 9.15673932058465e-06, -0.0019353170291447415, 1.233119546559081e-05, 1.382335460556349e-05, 6.042190571271e-08]}), (94, {0: [-0.00031840656148097795, 0.0003044419675915124, -0.001757449218079093, 7.01957681443819e-06, 1.283772127723177e-05, 5.639684814137e-08]}), (95, {0: [-0.00031850510897018196, 0.0003067894142386237, -0.0019285361634927758, 7.31777900854922e-06, 1.2841771025938e-05, -6.455925822264e-08]}), (96, {0: [-0.0003184092667410566, 0.00030438695499048456, -0.0017574806854780652, 1.22176399926244e-05, 1.283772224542666e-05, 5.639684528293e-08]}), (97, {0: [-0.00031850781258029194, 0.00030689154362856453, -0.0019288289909798993, 1.239587149510123e-05, 1.284177199433089e-05, -6.455925516741e-08]}), (109, {0: [-0.0005382170345556315, -8.015242021496332e-05, -0.0023325584851111325, -7.57678726589897e-06, 5.024360046618096e-05, -6.73e-18]}), (110, {0: [-0.0005379628312954263, -8.015242021496332e-05, -0.0023327116267777993, -7.57678726589897e-06, 0.00014855882790170734, -6.34e-18]}), (111, {0: [-0.000554039470769074, -8.015242021492967e-05, -0.002084681312580577, -7.57678726589912e-06, 4.882457710819538e-05, -6.73e-18]}), (112, {0: [0.0005382170344788692, -8.015242021711784e-05, -0.0023325584851107916, -7.57678726588857e-06, -5.024360046614505e-05, -6.73e-18]}), (113, {0: [0.000537962831218664, -8.015242021711784e-05, -0.0023327116267774584, -7.57678726588857e-06, -0.00014855882790170476, -6.34e-18]}), (114, {0: [0.0005540394706923117, -8.015242021715151e-05, -0.002084681312580417, -7.57678726588841e-06, -4.882457710815906e-05, -6.73e-18]}), (115, {0: [-0.0002689814156669037, -8.015242021550195e-05, -0.014055447203444179, -7.57678726589637e-06, 0.00010960663431057928, -6.34e-18]}), (116, {0: [-3.838111e-14, -8.015242021604058e-05, -0.018963963639191766, -7.57678726589377e-06, -2.15e-18, -6.34e-18]}), (117, {0: [0.0002689814155901414, -8.015242021657921e-05, -0.014055447203443863, -7.57678726589117e-06, -0.00010960663431058185, -6.34e-18]}), (127, {0: [0.00016396582129765791, -0.00012594019896239436, -0.0020758495845802946, -1.566794471489218e-05, -1.327098296330622e-05, -2.07013089661e-09]}), (128, {0: [0.00016396582129765791, -0.00012586986378030179, -0.0020759919213608653, -0.00011416591403816742, -1.327098296330622e-05, 1.0295934e-13]}), (129, {0: [0.00016395547064317488, -0.0001303180890465833, -0.002000827375891191, -1.426399704943354e-05, -1.327098298506217e-05, -2.07013089661e-09]}), (130, {0: [0.0001639657887625059, 0.00015088312472253136, -0.0020760369236929766, 1.576439057579173e-05, -1.327098158838948e-05, 2.06867471384e-09]}), (131, {0: [0.0001639657887625059, 0.00015081278954043878, -0.002076179250245739, 0.0001141755980168971, -1.327098158838948e-05, 1.0295934e-13]}), (132, {0: [0.0001639554453889367, 0.0001552610148067203, -0.0020005298786749627, 1.436149116273792e-05, -1.327098156663517e-05, 2.06867471384e-09]}), (133, {0: [0.00016396581316386992, -5.669920045011664e-05, -0.010520932365032326, -8.544846153287553e-05, -1.327098261957703e-05, 1.0295934e-13]}), (134, {0: [0.0001639658050300819, 1.24714628800685e-05, -0.014083019441466076, -3.31021407265e-09, -1.327098227584785e-05, 1.0295934e-13]}), (135, {0: [0.0001639657968962939, 8.164212621025365e-05, -0.010521348041510543, 8.544591720644898e-05, -1.327098193211866e-05, 1.0295934e-13]}), (145, {0: [0.0005382170344520239, 0.00010131007195211938, -0.0023356054919708917, 7.35839727478936e-06, -5.02436004636358e-05, -6.73e-18]}), (146, {0: [0.0005379628311918327, 0.00010131007195211938, -0.002335758633637558, 7.35839727478936e-06, -0.00014855882790097832, -6.34e-18]}), (147, {0: [0.0005540394706645995, 0.00010131007195208573, -0.002087728319453116, 7.35839727478955e-06, -4.882457710562861e-05, -6.73e-18]}), (148, {0: [-0.0005382170345234918, 0.00010131007195427403, -0.002335605491970906, 7.35839727477903e-06, 5.024360046363568e-05, -6.73e-18]}), (149, {0: [-0.0005379628312633005, 0.00010131007195427403, -0.0023357586336375724, 7.35839727477903e-06, 0.00014855882790097818, -6.34e-18]}), (150, {0: [-0.0005540394707360673, 0.0001013100719543077, -0.0020877283194531307, 7.35839727477887e-06, 4.882457710562849e-05, -6.73e-18]}), (151, {0: [0.0002689814155780494, 0.00010131007195265804, -0.014058494210257557, 7.35839727478677e-06, -0.0001096066343102167, -6.34e-18]}), (152, {0: [-3.573392e-14, 0.00010131007195319671, -0.018967010645989837, 7.35839727478419e-06, -3e-20, -6.34e-18]}), (153, {0: [-0.00026898141564951725, 0.00010131007195373537, -0.014058494210257563, 7.35839727478161e-06, 0.00010960663431021664, -6.34e-18]}), (163, {0: [-0.0001639657888342622, 0.00015088312472482556, -0.002076036923692755, 1.576439057578139e-05, 1.327098158839496e-05, -2.06867472735e-09]}), (164, {0: [-0.0001639657888342622, 0.00015081278954273298, -0.0020761792502455175, 0.0001141755980168971, 1.327098158839496e-05, -1.0297691e-13]}), (165, {0: [-0.00016395544546062544, 0.00015526101480901452, -0.002000529878674793, 1.436149116272745e-05, 1.327098156663754e-05, -2.06867472735e-09]}), (166, {0: [-0.0001639658213749643, -0.0001259401989601006, -0.0020758495845805097, -1.566794471490257e-05, 1.327098296341171e-05, 2.07013088324e-09]}), (167, {0: [-0.0001639658213749643, -0.00012586986377800802, -0.0020759919213610804, -0.00011416591403816723, 1.327098296341171e-05, -1.0297691e-13]}), (168, {0: [-0.00016395547072054807, -0.00013031808904428956, -0.0020008273758913542, -1.426399704944405e-05, 1.327098298516811e-05, 2.07013088324e-09]}), (169, {0: [-0.00016396579696943773, 8.164212621254774e-05, -0.010521348041510387, 8.544591720645049e-05, 1.327098193214915e-05, -1.0297691e-13]}), (170, {0: [-0.00016396580510461326, 1.247146288236248e-05, -0.014083019441466066, -3.31021407062e-09, 1.327098227590333e-05, -1.0297691e-13]}), (171, {0: [-0.00016396581323978876, -5.669920044782277e-05, -0.010520932365032465, -8.544846153287394e-05, 1.327098261965752e-05, -1.0297691e-13]}), (172, {0: [-2.339557e-14, 1.726512555524e-07, 0.0, 0.0, 0.0, -2.42e-18]}), (173, {0: [-3.694626e-14, 1.190554506456846e-05, 0.0, 0.0, 0.0, -6.73e-18]})])
[7]:
# Displacement of the parent node of the top story,
# in the Y direction.
analysis_step = 0
direction = 1
node_id = testcase.parent_nodes[2].uid
static_anl.results[testcase.name].node_displacements[
node_id][analysis_step][direction]
[7]:
1.190554506456846e-05
Note: Multiple load cases and analysis objects can be defined using the same model. The results will be stored independently in the various analysis objects.
Visualizing results¶
The following visualization methods work for all analysis methods. However, some require specifying the analysis step to visualize. Static analyses only have a single step, so we specify 0.
[8]:
from osmg.graphics.postprocessing_3d import show_deformed_shape
from osmg.graphics.postprocessing_3d import show_basic_forces
[9]:
help(show_deformed_shape)
Help on function show_deformed_shape in module osmg.graphics.postprocessing_3d:
show_deformed_shape(analysis: 'Analysis', case_name: 'str', step: 'int', scaling: 'float', extrude: 'bool', camera: 'Optional[dict[str, object]]' = None, subset_model: 'Model' = None, animation: 'bool' = False, init_step: 'int' = 0, step_skip: 'int' = 0, to_html_file: 'Optional[str]' = None) -> 'dict[str, Any]'
Visualize the model in its deformed state
Arguments:
analysis: an analysis object
case_name: the name of the load_case to be visualized
step: the analysis step to be visualized
scaling: scaling factor for the deformations. If 0.00 is
provided, the scaling factor is calculated automatically.
extrude: wether to extrude frame elements
camera: custom positioning of the camera
subset_model: subset model used to only show certain
components
animation: show all frames up to the one identified with
`step`
init_step: starting step, in case of animation
step_skip: how many frames to skip to reduce the number of
frames in case an animation.
to_html_file: If a path is specified, the figure is written in
an html file instead of being shown.
[10]:
show_deformed_shape(static_anl, testcase.name, 0, 0.00, False)
[10]:
{'scaling': 2024.567851872791}
[11]:
help(show_basic_forces)
Help on function show_basic_forces in module osmg.graphics.postprocessing_3d:
show_basic_forces(analysis, case_name, step, scaling_global, scaling_n, scaling_q, scaling_m, scaling_t, num_points, force_conversion=1.0, moment_conversion=1.0, global_axes=False, camera=None, subset_model=None, to_html_file=None)
Visualize the model and plot the frame element basic forces.
Arguments:
analysis: an analysis object
case_name: the name of the load_case to be visualized
step: the analysis step to be visualized
scaling_global: I don't even remember what this
does. It's kind of a mess right now.
scaling_n:
scaling_q:
scaling_m:
scaling_t:
num_points: number of points to include in the basic force
curves
force_conversion: Conversion factor to be applied at the
hover box data for forces (for unit conversions)
moment_conversion: Conversion factor to be applied at the
hover box data for moments (for unit conversions)
global_axes: whether to show global axes
camera: custom positioning of the camera
subset_model: use this model instead of the one contained in the
analysis object. It needs to be a subset of the original
model. This can be used to only show the results for some part
of a large model.
to_html_file: If a path is specified, the figure is written in
an html file instead of being shown.
[12]:
show_basic_forces(
static_anl, testcase.name, 0,
1.00, 1.00, 1.00, 1.00, 1.00,
10, 1.00, 1.00, False)
[12]:
{'scaling_n': 0.0023065720290572655,
'scaling_q': 0.011840888066593308,
'scaling_m': 0.0001717128370176217,
'scaling_t': 1.0}
Modal Analysis¶
[13]:
modalcase = LoadCase('modal', mdl)
self_mass(mdl, modalcase)
modalcase.rigid_diaphragms([1, 2])
[14]:
modal_analysis = solver.ModalAnalysis(
mdl, {modalcase.name: modalcase}, num_modes=4)
modal_analysis.run()
[15]:
print(modal_analysis.results[modalcase.name].periods)
[0.4052417 0.21765894 0.20045611 0.20001172]
for modal analyses, step corresponds to mode
[16]:
show_deformed_shape(
modal_analysis, modalcase.name, 3, 0.00,
extrude=False, animation=False)
[16]:
{'scaling': 121.0009924967045}
Time-history analysis¶
[17]:
nlth_anl = solver.THAnalysis(mdl, {testcase.name: testcase})
[18]:
help(nlth_anl.run)
Help on method run in module osmg.solver:
run(analysis_time_increment: 'float', ag_vec_x: 'Optional[nparr]', ag_vec_y: 'Optional[nparr]', ag_vec_z: 'Optional[nparr]', ag_vec_time_incr: 'float', finish_time: 'float' = 0.0, skip_steps: 'int' = 1, damping: 'dict[str, Optional[Union[str, float, int, list[float]]]]' = {'type': None}, print_progress: 'bool' = True, drift_check: 'float' = 0.0, time_limit: 'Optional[float]' = None, dampen_out_residual: 'bool' = False) -> 'dict[str, Union[int, str, float]]' method of osmg.solver.THAnalysis instance
Run the time-history analysis
Arguments:
ag_vec_x, y, z: 1-D numpy arrays containing the fixed-step
ground acceleration records.
ag_vec_time_incr: The corresponding time increment
finish_time: Specify a target time (s) to stop the analysis
the default value of 0.00 means that it will
run for the entire duration of the files.
damping: Can be any of:
{'type': None},
{'type': 'rayleigh', 'ratio': r, 'periods': [t1, t2]},
{'type': 'stiffness', 'ratio': r, 'period': t1}
{'type': 'modal', 'num_modes': n, 'ratio': r}
{'type': 'modal+stiffness', 'num_modes': n,
'ratio_modal': r, 'period': t1,
'ratio_stiffness': r}
print_progress: Controls whether the current time is printed out
drift_check: If a value other than 0.00 is specified, the
analysis stops if the drift ratio in each orthogonal
direction exceeds the specified value. Levels that have
no parent nodes are excempt from this check.
time_limit: Maximum analysis time allowed, in hours.
When reached, the anlysis is interrupted.
dampen_out_residual: When the analysis finishes, whether to
dampen out the motion to reveal the residual deformations.
Note that retrieving the absolute velocity and acceleration
will not output the correct values after dampening starts.
[19]:
ag_x = np.genfromtxt('groundmotions/1xa.txt')
ag_y = np.genfromtxt('groundmotions/1ya.txt')
nlth_anl.run(
0.01,
ag_x, ag_y, None,
0.005,
damping={'type': 'rayleigh', 'ratio': 0.05, 'periods': [1.00, 0.30]},
print_progress=True
)
100%|████████████████████████▉| [01:18<00:00, 2.59s/it, time=30.4000/30.40 [1]]
[19]:
{'successful steps': 3040, 'analysis_finished_successfully': True}
[20]:
parent_node_lvl2 = testcase.parent_nodes[2]
[21]:
nlth_anl.plot_node_displacement_history(
testcase.name, parent_node_lvl2, 0, plotly=True)
Other types of structural analysis and ideas for future development¶
Currently it is unclear what the intent of each model is (i.e. a linear model used for design or an advanced model used for performance evaluation purposes). There is already support for design-related analyses, such as modal response spectrum analysis, and definition of load combinations, which can support a design workflow. Examples will be added in the future, and there are plans to further enhance the capabilities of
osmgfor structural design.Future plans include adding support for modal response history analysis which can reduce computation time for linear models.